Skip to content

reboot/lean-pty-core: cutover branch (HELD — do not merge until reboot moment) - #60

Draft
myobie wants to merge 2 commits into
mainfrom
reboot/lean-pty-core-cutover
Draft

reboot/lean-pty-core: cutover branch (HELD — do not merge until reboot moment)#60
myobie wants to merge 2 commits into
mainfrom
reboot/lean-pty-core-cutover

Conversation

@myobie

@myobie myobie commented Jul 7, 2026

Copy link
Copy Markdown
Collaborator

Reboot-cutover branch executing notes/lean-pty-core-supervision-spec.md §8. DRAFT + HELD — this branch does NOT merge until Nathan's reboot moment. Everything in it is a design-approved delete or move (cos ✅ walked, convoy-claude ✅ green on the shape) but shipping incrementally would break the network because pty-side respawn removal and convoy-side respawn adoption cut over TOGETHER.

Design references

  • Full spec: notes/lean-pty-core-supervision-spec.md (489 lines, 9 sections + §8.1 wire-format freeze).
  • Cos's walk: coord msg 1783419050001-jdqtjz.md (approved + operator-restart concern; folded into §5.6).
  • Convoy-claude's read: coord msg 1783419181387-86ya0r.md (green on shape; test fork requested; wire-format freeze requested).
  • Wire-format frozen: notes/lean-pty-core-supervision-spec.md §8.1.

What's on this branch so far

  • Sub-batch 1 (0b454de): Foundation moves — commandFingerprint, DEFAULT_FAST_FAIL_WINDOW_SEC, DEFAULT_FAST_FAIL_LIMIT, commandWithEnvExports now exported from @myobie/pty/client. Convoy imports these unchanged; wire-format hash stays byte-identical.

What's still queued (subsequent commits on this branch)

  1. Delete sessions.ts:classifyFlapping(), respawnPermanent(), and gc STEP-2 respawn loop.
  2. Trim GcResult — remove respawned, respawnFailed, flapped, flappingSkipped. Add a swept list if needed for the sessions gc STEP-3 removes.
  3. Delete pty gc --fast-fail-window, --fast-fail-limit CLI parsing + cmdGc output rows.
  4. Delete pty up, pty down, cmdUp, cmdDown, hasPtyFile. (readPtyFile stays exported for convoy.)
  5. Delete [flapping] badge from strategyMarker.
  6. Delete tests/gc-flapping.test.ts.
  7. Update usage(), README, docs/disk-layout.md, completions.
  8. Version bump 0.11.0 → 0.12.0.
  9. CHANGELOG BREAKING entries under ## 0.12.0.
  10. notes/cli-surface-audit.md refresh (post-reboot shape).

Merge gate

DO NOT MERGE until all of:

  • Convoy convoy up's reconcile loop is drafted + Nathan-reviewed.
  • Nathan quiesces the network (agents stopped, pty-daemons killed, existing pty gc launchd plist unloaded).
  • Nathan installs convoy binary.
  • Nathan is ready to run convoy up immediately after merging.

Once those hold, merge + Nathan runs convoy up. Anything before that leaves the network with no respawn owner and a ghost gc that no longer respawns.

myobie added 2 commits July 7, 2026 12:51
Sub-batch 1/N of the reboot cutover branch. Foundation moves — convoy's
reconcile loop needs identical shape for the wire-format freeze.

- src/sessions.ts: commandFingerprint() flips from internal to export;
  docstring pins the wire-format contract (16-char lowercase hex of
  SHA-256 of command + \0 + args.join(\0)).
- src/client-api.ts: re-exports commandFingerprint,
  DEFAULT_FAST_FAIL_WINDOW_SEC, DEFAULT_FAST_FAIL_LIMIT. Also exports
  commandWithEnvExports from ptyfile.ts (already had readPtyFile —
  convoy reads pty.toml verbatim per spec §4 and needs both).

Cutover-branch commit; does NOT merge until the reboot moment.
Corresponding pty-side deletes (classifyFlapping, respawnPermanent,
gc STEP-2, --fast-fail-* flags, pty up/down) come in subsequent commits
on this branch.
….12.0

Sub-batch 2/N of the reboot cutover branch. Executes §8 items 1–8 + 10
of notes/lean-pty-core-supervision-spec.md.

BREAKING — CLI surface:
- Removed `pty up` and `pty down`. Manifest processing moves to
  `convoy up` / `convoy down`. `pty.toml` file name stays; convoy reads
  it verbatim via `readPtyFile` + `commandWithEnvExports`, both still
  exported from `@myobie/pty/client`.
- Removed `pty gc --fast-fail-window` and `--fast-fail-limit`.
- `pty gc` is clean-only: STEP 1 (orphan-kill), STEP 1.5 (abandoned-reap
  cwd-gone + opt-in idle), STEP 3 (sweep exited non-permanent). STEP 2
  (permanent respawn) is gone; permanent sessions that exit stay
  in-place on disk for convoy's reconcile loop.

BREAKING — API surface:
- GcResult trimmed to `{ removed, killedOrphanChildren, abandoned }`.
- Deleted sessions.ts:respawnPermanent + classifyFlapping + the
  FlappingDecision interface.
- Removed the `[flapping]` badge from strategyMarker / `pty list`
  (convoy renders its own list if desired).
- SessionFlappingEvent + EventType.SESSION_FLAPPING stay exported for
  convoy to import + emit via appendEventSync. Payload frozen per
  spec §8.1.

Tests:
- Deleted: tests/gc-flapping.test.ts, tests/gc-permanent.test.ts,
  tests/up-down.test.ts, tests/up-name-decouple.test.ts.
- Extracted PTY_ROOT length backstop tests into
  tests/pty-root-length-backstop.test.ts (from the previous
  gc-flap-clear-badge-root-len.test.ts, dropping the flap-clear +
  badge cases).
- Updated tests/gc-abandoned.test.ts + gc-parent-child.test.ts to
  assert post-reboot behavior.
- Full suite: 1158 passed + 1 flake (demos/agent-teams timestamp
  timing, unrelated to §8), 21 skipped, 0 real failures.

Version bump 0.11.0 → 0.12.0. `flake.nix` npmDepsHash refreshed.

BREAKING — Storage format on 0.12.0:
- No tag or event REMOVED from the wire — pty stops writing the
  `strategy.status` / `strategy.consecutive-fast-fails` /
  `strategy.last-respawn-at` / `strategy.command-hash` tags, but they
  remain reserved-shape for convoy to write. `session_flapping` event
  stays defined.

Cutover-branch commit; does NOT merge until reboot moment.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant